private import base;

contract coercion over (%s,%d) is {
  coerce has type (%s)=>%d;
}

implementation coercion over (string,boolean) is {
  coerce(string(X)) is __string_boolean(X);
}

implementation coercion over (string,char) is {
  coerce(string(X)) is char(__string_char(X));
}

implementation coercion over (string,integer) is {
  coerce(string(X)) is integer(__string_integer(X));
}

implementation coercion over (string,long) is {
  coerce(string(X)) is long(__string_long(X));
}

implementation coercion over (string,float) is {
  coerce(string(X)) is float(__string_float(X));
}

implementation coercion over (string,decimal) is {
  coerce(string(X)) is decimal(__string_decimal(X));
}

implementation coercion over (string,binary) is {
  coerce(S) is __string_binary(S);
}

implementation coercion over (boolean,string) is {
  coerce(true) is "true";
  coerce(false) is "false";
}

implementation coercion over (char,string) is {
  coerce(char(C)) is string(__char_string(C));
}

implementation coercion over (integer,string) is {
  coerce(integer(I)) is string(__integer_string(I));
}

implementation coercion over (long,string) is {
  coerce(long(L)) is string(__long_string(L));
}

implementation coercion over (float,integer) is {
  coerce(float(F)) is integer(__float_integer(F));
}
implementation coercion over (float,long) is {
  coerce(float(F)) is long(__float_long(F));
}

implementation coercion over (float,decimal) is {
  coerce(float(F)) is decimal(__float_decimal(F));
}

implementation coercion over (float,string) is {
  coerce(float(F)) is string(__float_string(F));
}

implementation coercion over (decimal,string) is {
  coerce(decimal(D)) is string(__decimal_string(D));
}

implementation coercion over (string,string) is {
  coerce(X) is X;
}

implementation coercion over (integer,long) is {
  coerce(integer(X)) is long(__integer_long(X));
}

implementation coercion over (integer,float) is {
  coerce(integer(X)) is float(__integer_float(X));
}

implementation coercion over (integer,decimal) is {
  coerce(integer(X)) is decimal(__integer_decimal(X));
}

implementation coercion over (long,integer) is {
  coerce(long(X)) is integer(__long_integer(X));
}

implementation coercion over (long,float) is {
  coerce(long(X)) is float(__long_float(X));
}

 implementation coercion over (long,decimal) is {
  coerce(long(X)) is decimal(__long_decimal(X));
}
 
implementation coercion over (string,uri) is {
  coerce(string(S)) is __string2uri(S);
}

implementation coercion over (uri,string) is {
  coerce(U) is string(__uri2string(U));
}

implementation coercion over (binary,string) is {
  coerce(S) is __binary_string(S);
}

implementation coercion over (integer,char) is {
  coerce(integer(I)) is char(__integer_char(I));
}

implementation coercion over (char,integer) is {
  coerce(char(C)) is integer(__char_integer(C));
}

implementation coercion over (long,char) is {
  coerce(long(I)) is char(__integer_char(__long_integer(I)));
}

implementation coercion over (char,long) is {
  coerce(char(C)) is long(__integer_long(__char_integer(C)));
}

implementation coercion over (quoted,string) is {
  coerce(Q) is __display(Q);
}